<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="mail_account" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 电子邮件 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="地址" prop="mail_account">
              <el-input v-model="mail_account.mail_account" placeholder='输入163或QQ邮箱' />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="密码" prop="mail_password">
              <el-input v-model="mail_account.mail_password" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="重复密码" prop="mail_password1">
              <el-input v-model="mail_account.mail_password1" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="QQ邮箱授权码" prop="authorization_code">
              <el-input v-model="mail_account.authorization_code" placeholder='输入QQ邮箱授权码' />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="increaseMailboxInformationSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/oa/communication/MailboxSetting?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'IncreaseMailboxInformation',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        mail_account: {
          mail_account: null,
          mail_password: null,
          mail_password1: null,
          authorization_code: null,
        },
        loading: false,
        rules: {
          mail_account: [{
            required: true,
            message: "地址不能为空",
            trigger: 'blur',
          }],
          mail_password: [{
            required: true,
            message: "密码不能为空",
            trigger: 'blur',
          }],
          authorization_code: [{
            required: true,
            message: "QQ邮箱授权码不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      increaseMailboxInformationSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/oa/communication/EmailAction/increaseMailboxInformationSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/oa/communication/MailboxSetting/mailboxSetting?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
